﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using NicoView.Model.Service.Comments;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace NicoView.Model.Service.Property
{

    public enum CommentNgShareLevel
    {
        None,
        Low,
        Medium,
        High
    }

    

    public sealed class NicoViewRomingProperty:NicoViewObservableObject
    {
        

        public NicoViewRomingProperty()
        {
            this.SpeechEnable = false;
            this.SpeechLearnEnable = true;
            this.NgAvoidance = true;
            this.AtMarkNameToCustomName = true;
            this.VisibleCustomNameOnly = true;
            this.NextFrameAutoConnection = true;
            this.NextFrameAutoConnectionWithBrowser = true;
            this.commentNgShareLevel = CommentNgShareLevel.Medium;
            this.anonymousSend = false;
            this.ownerSend = false;
            this.visibleAnonymous = true;
            this.visibleCommentArtComment = false;
            this.auth = new NicoSafeUserAuth();
            this.usingBroadcasatEncoder = false;

        }


        private bool visibleCommentArtComment;

        public bool VisibleCommentArtComment
        {
            get
            {
                return this.visibleCommentArtComment;
            }

            set
            {


                Set(()=>VisibleCommentArtComment, ref this.visibleCommentArtComment, value);
            }
        }

        private bool visibleAnonymous;
        public bool VisibleAnonymous
        {
            get
            {
                return this.visibleAnonymous;
            }
            set
            {
                Set(()=>VisibleAnonymous, ref this.visibleAnonymous, value);
            }
        }

        private bool speech;

        public bool SpeechEnable
        {
            get
            {
                return this.speech;
            }
            set
            {
                Set(()=>SpeechEnable, ref this.speech, value);
            }
        }

        private bool nextFrameAutoConnection;

        public bool NextFrameAutoConnection
        {
            get
            {
                return this.nextFrameAutoConnection;
            }

            set
            {
                Set(()=>NextFrameAutoConnection, ref  this.nextFrameAutoConnection, value);
            }

        }

        private bool usingBroadcasatEncoder;

        public bool UsingBroadcasatEncoder
        {
            get
            {
                return this.usingBroadcasatEncoder;
            }

            set
            {
                this.Set(() => this.UsingBroadcasatEncoder, ref this.usingBroadcasatEncoder, value);

                if (this.UsingBroadcasatEncoder)
                {
                    NicoViewApplication.Current.Instance.StartBroadcatEncode();
                }
                else
                {
                    NicoViewApplication.Current.Instance.StopBroadcastEncode();
                }
            }

        }



        private bool ownerSend;
        public bool OwnerSend
        {
            get
            {
                return this.ownerSend;
            }

            set
            {
                Set(()=>OwnerSend, ref this.ownerSend, value);
            }
        }

        private bool anonymousSend;
        public bool AnonymousSend
        {
            get
            {
                return this.anonymousSend;

            }

            set
            {
                Set(()=>AnonymousSend, ref this.anonymousSend, value);
            }
        }

        private bool speechlearnEnable;
        public bool SpeechLearnEnable
        {
            get
            {
                return speechlearnEnable;
            }
            set
            {
                Set(()=>SpeechLearnEnable, ref speechlearnEnable, value);
            }
        }

        private bool ngAvoidance;
        public bool NgAvoidance
        {
            get
            {
                return ngAvoidance;
            }
            set
            {
                Set(()=>NgAvoidance, ref ngAvoidance, value);
            }
        }

        private bool atMarkNameToCustomName;
        public bool AtMarkNameToCustomName
        {
            get
            {
                return atMarkNameToCustomName;
            }
            set
            {
                Set(()=>AtMarkNameToCustomName, ref atMarkNameToCustomName, value);
            }
        }

        private bool visibleCustomNameOnly;
        public bool VisibleCustomNameOnly
        {
            get
            {
                return visibleCustomNameOnly;
            }
            set
            {
                Set(()=>VisibleCustomNameOnly, ref  visibleCustomNameOnly, value);
            }
        }

        private bool autoCreateaNextBroadcast;

        public bool AutoCreateNextBroadcast
        {
            get
            {
                return this.autoCreateaNextBroadcast;
            }

            set
            {
                this.Set(() => this.AutoCreateNextBroadcast, ref this.autoCreateaNextBroadcast, value);
            }
        }

        private bool nextFrameAutoConnectionWithBrowser;
        public bool NextFrameAutoConnectionWithBrowser
        {
            get
            {
                return this.nextFrameAutoConnectionWithBrowser;
            }
            set
            {
                Set(()=>NextFrameAutoConnectionWithBrowser, ref this.nextFrameAutoConnectionWithBrowser, value);
            }
        }

        private CommentNgShareLevel commentNgShareLevel;

        [JsonProperty]
        [JsonConverter(typeof(StringEnumConverter))]
        public CommentNgShareLevel CommentNgShareLevel
        {
            get { return this.commentNgShareLevel; }
            set { Set(()=>CommentNgShareLevel, ref this.commentNgShareLevel, value); }
        }

        private NicoSafeUserAuth auth;

        public NicoSafeUserAuth Auth
        {
            get
            {
                return this.auth;
            }
            set
            {
                this.Set(() => this.Auth, ref this.auth, value);
            }
        }
    }
}
